Skip to content

fix: elastic-otel jq filter fails on jq 1.6 (cflinuxfs4) - #1489

Merged
stokpop merged 1 commit into
cloudfoundry:mainfrom
stokpop:fix-elastic-otel-jq16
Oct 22, 2026
Merged

stokpop merged 1 commit into
cloudfoundry:mainfrom
stokpop:fix-elastic-otel-jq16

Conversation

@stokpop

@stokpop stokpop commented Oct 22, 2026

Copy link
Copy Markdown
Contributor

Problem

specs-unit fails on main since #1360 was merged (build 230):

[FAIL] ElasticOtelJavaAgentFramework Finalize [It] resolves headers at runtime and prioritizes an explicit service label
Expected <string>: "" to equal <string>: Authorization=ApiKey right%2Bkey%2F%3D%3D

The runtime jq filter in elastic_otel_java_agent.sh uses .key as $label. label is a reserved keyword in jq 1.6, so the filter does not compile:

jq: error: syntax error, unexpected label, expecting IDENT (Unix shell quoting issues?)

jq 1.7 accepts keywords as variable names, which is why the spec passes locally and on cflinuxfs5. The CI image (cfbuildpacks/ci) and cflinuxfs4 ship jq 1.6, so on cflinuxfs4 apps OTEL_EXPORTER_OTLP_HEADERS is never resolved from VCAP_SERVICES (only a warning is printed).

Fix

Rename $label to $service_label. No other jq variables in the buildpack use reserved keywords.

Testing

  • go test ./src/java/frameworks/ inside cfbuildpacks/ci (jq 1.6): failed before, passes after.
  • Same with local jq 1.7: passes.
  • docker run cloudfoundry/cflinuxfs4 jq --version shows jq-1.6; cflinuxfs5 shows jq-1.7.

`label` is a reserved keyword in jq 1.6, so `.key as $label` is a
syntax error there. jq 1.7 (cflinuxfs5) accepts it. On cflinuxfs4 the
profile.d script could not resolve OTEL_EXPORTER_OTLP_HEADERS from
VCAP_SERVICES. Rename the variable to $service_label.
@stokpop
stokpop merged commit b5c8734 into cloudfoundry:main Oct 22, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants